package cn.xingzhe.monster.user.domain.enums;

import open.intellijboy.framework.core.response.BaseEnum;

/**
 * 验证码类型枚举
 *
 * @author System
 * @version 1.0.0
 * @since 2024-01-01
 */
public enum CaptchaTypeEnum implements BaseEnum {

    /**
     * 注册验证码
     */
    REGISTER(1, "注册验证码"),

    /**
     * 登录验证码
     */
    LOGIN(2, "登录验证码");

    private final Integer code;
    private final String message;

    CaptchaTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    /**
     * 根据code获取枚举
     *
     * @param code 枚举码
     * @return 枚举实例
     */
    public static CaptchaTypeEnum getByCode(Integer code) {
        return BaseEnum.getByCode(CaptchaTypeEnum.class, code);
    }
}

